package action.info;

import java.util.List;

import persistence.model.TdfkfaDoc;
import presentation.PageVO;
import presentation.extendmodel.DocDetailModel;
import presentation.queryvo.DocQueryVO;
import service.DocService;

import com.googlecode.jsonplugin.annotations.JSON;
import com.opensymphony.xwork2.ActionSupport;

public class DocAction extends ActionSupport {

    private static final long serialVersionUID = -5295276973452637507L;

    private DocService docService;

    private List<TdfkfaDoc> docList;

    private DocDetailModel docDetail;

    private String docId;

    private PageVO pageVO;

    private DocQueryVO queryVO;

    public String displayDocList() throws Exception {

        pageVO.setRecordNum(docService.countDoc(queryVO));
        docList = docService.getDocList(queryVO, pageVO.getIntPageIndex(), pageVO.getIntPageSize());
        return SUCCESS;
    }

    public String displayDocDetail() throws Exception {

        docDetail = docService.getDocDetail(new Integer(docId));
        return SUCCESS;
    }

    @JSON(format = "yyyy-MM-dd HH:mm:ss")
    public List<TdfkfaDoc> getDocList() {
        return docList;
    }

    public void setDocId(String docId) {
        this.docId = docId;
    }

    public DocDetailModel getDocDetail() {
        return docDetail;
    }

    public DocQueryVO getQueryVO() {
        return queryVO;
    }

    public void setQueryVO(DocQueryVO queryVO) {
        this.queryVO = queryVO;
    }

    public PageVO getPageVO() {
        return pageVO;
    }

    public void setPageVO(PageVO pageVO) {
        this.pageVO = pageVO;
    }

    public void setDocService(DocService docService) {
        this.docService = docService;
    }
}
